import components from './components/index.js'

import { getCookies, setCookies, getToken, clearCookies, setLocalStorage, removeLocalStorage, clearLocalStorage, getLocalStorage, setSessionStorage, setAllSessionStorage, removeSessionStorage, clearSessionStorage, getSessionStorage, getSessionStorageAll, getCookiesAll, getLocalStorageAll } from './utils/cache.js'

import { isBoolean, isObject, isArray, isString, isNumber, isFunction, isUndefined, isNull, isEmpty, isNotNull, trim, http, deepClone } from './utils/tools.js'

import request from './utils/request.js'

import { useFetch } from './hooks/fetch.js'

import { usePageInfo } from '@/hooks/pageInfo'

import asyncSelect from './components/widget/asyncSelect.vue'
import datePicker from './components/widget/datePicker.vue'
import fileUpload from './components/widget/fileUpload.vue'
import imgUpload from './components/widget/imgUpload.vue'
import selectTree from './components/widget/selectTree.vue'
import v3Form from './components/widget/v3Form.vue'
import v3Table from './components/widget/v3Table.vue'
import v3Query from './components/widget/v3Query.vue'
import v3Crud from './components/index.vue'

const tool = {
    getCookies, setCookies, getToken, clearCookies, setLocalStorage, removeLocalStorage, clearLocalStorage, getLocalStorage, setSessionStorage, setAllSessionStorage, removeSessionStorage, clearSessionStorage, getSessionStorage, getSessionStorageAll, getCookiesAll, getLocalStorageAll,
    isBoolean, isObject, isArray, isString, isNumber, isFunction, isUndefined, isNull, isEmpty, isNotNull, trim, request, useFetch, usePageInfo, http, deepClone
}

const install = function(Vue, opts = {}) {
    components.forEach(component => {
        Vue.component(component.name, component);
    });
};

export { tool };

export {
    asyncSelect, datePicker, fileUpload, imgUpload, selectTree, v3Form, v3Table, v3Query, v3Crud
}

export default {
    install
}